/**
 * @description HTTP请求返回格式
 * @author malin
 */

class BaseModel {
    constructor({ code, data, msg }) {
        this.code = code
        data && (this.data = data)
        msg && (this.msg = msg)
    }
}

class SuccessModel extends BaseModel {
    constructor(data = {}) {
        super({
            code: 0,
            data
        })
    }
}

class ErrorModel extends BaseModel {
    constructor({ code, msg }) {
        super({ code, msg })
    }
}

module.exports = {
    SuccessModel,
    ErrorModel
}
